Skip to content

fix: improve apps deploy error when APP_NAME is missing#5113

Merged
jamesbroadhead merged 11 commits into
mainfrom
jb/improve-apps-deploy-error-message
May 20, 2026
Merged

fix: improve apps deploy error when APP_NAME is missing#5113
jamesbroadhead merged 11 commits into
mainfrom
jb/improve-apps-deploy-error-message

Conversation

@jamesbroadhead
Copy link
Copy Markdown
Contributor

Replaces #4820 — re-opened from an upstream branch (was previously from a fork, which blocked CI from running properly).

Summary

  • Replace the opaque accepts 1 arg(s), received 0 error with a clear message explaining that APP_NAME is required
  • Show usage, mention the databricks.yml auto-detect alternative, and suggest an app name inferred from the current directory name

Test plan

  • go test ./cmd/apps/ -run TestMakeArgsOptional passes
  • go build ./cmd/apps/ succeeds

This pull request was AI-assisted by Isaac.

The old error "accepts 1 arg(s), received 0" was unclear. The new message
explains that APP_NAME is required, shows usage, mentions the databricks.yml
alternative, and suggests an app name inferred from the current directory.

Co-authored-by: Isaac
Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
Co-authored-by: Isaac
Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
Cover normal cases (app.yml, app.yaml, no config) and edge cases
(deleted cwd) to verify graceful degradation.

Co-authored-by: Isaac
Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
Co-authored-by: Isaac
Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
- Check os.WriteFile error return values
- Use t.Chdir() instead of manual os.Chdir + cleanup
- Remove unnecessary testChdir helper

Co-authored-by: Isaac
Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
The shared zero-arg validator used by deploy/start/stop/delete printed a
hardcoded "databricks apps deploy <hint>" suggestion and a generic
"<command>" placeholder in the usage line, so users running `apps stop`
without an APP_NAME were nudged toward `apps deploy` instead.

- Thread the cobra command into missingAppNameError and render both the
  Usage line and the "Did you mean?" hint from cmd.CommandPath().
- Extend bundle_helpers_test.go with table-driven coverage that exercises
  deploy/start/stop/delete and asserts the hint matches the verb.
- inferAppNameHint now requires app.yml/app.yaml to be a regular file,
  so a directory of that name no longer produces a bogus hint.
- Regenerate the no-bundle-no-args acceptance fixture for the new
  message.

Co-authored-by: Isaac
@jamesbroadhead
Copy link
Copy Markdown
Contributor Author

👋 @pietern @fjakobs — Claude here on James's behalf.

Rebased onto current main. Diff unchanged: 3 files, +154/-2 (cmd/apps/bundle_helpers.go + new bundle_helpers_test.go + the no-bundle-no-args acceptance golden update). Build, unit tests, and the affected acceptance test all pass locally.

Ready for review whenever you've got a moment.

(comment posted by Claude)

@jamesbroadhead jamesbroadhead force-pushed the jb/improve-apps-deploy-error-message branch from c654348 to 6c3d347 Compare May 18, 2026 22:33
Reuse the shared missing-name validation for logs and render each command's documented positional argument name.
Copy link
Copy Markdown
Member

@simonfaltum simonfaltum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the apps missing-name error changes and pushed a small follow-up to keep logs on the shared validation path and align NAME vs APP_NAME in the error text. Scoped validation passed locally: go test ./cmd/apps/... and ./task checks. No completed CI failures at approval time; a few longer-running jobs are still pending.

@jamesbroadhead jamesbroadhead enabled auto-merge May 20, 2026 15:41
@jamesbroadhead jamesbroadhead added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit 7e0236a May 20, 2026
24 checks passed
@jamesbroadhead jamesbroadhead deleted the jb/improve-apps-deploy-error-message branch May 20, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants